import "./EditMemberGrade.css"
import React, { useState, useEffect } from 'react';
import myAxios from '../../../utils/myAixos.js'
import { useNavigate, useLocation } from 'react-router-dom';
import {
    Button,
    Cascader,
    Checkbox,
    DatePicker,
    Form,
    Input,
    InputNumber,
    Radio,
    Select,
    Switch,
    TreeSelect,
    Upload,
    message,
} from 'antd';

//表单
const { RangePicker } = DatePicker;
const { TextArea } = Input;
//多选框
const onChange = (checkedValues) => {
    console.log('checked = ', checkedValues);
};
const options = [
    {
        label: '健身馆',
        value: '健身馆1',
    },
    {
        label: '健身馆',
        value: '健身馆2',
    },

];
const EditMemberGrade = () => {
    let location = useLocation();
    console.log("会员卡传参" + location.state.m_carname)
    const navigate = useNavigate()
    const fanhui = () => {
        navigate(-1)
    }
    const onFinish = (values) => {
        console.log("5566677" + values);
        console.log("2345u87421346");

        myAxios({
            url: '/mcarEdits',
            method: 'post',
            data: {
                m_carname: location.state.m_carname,
                m_jifen: values.m_jifen,
                m_teacher: values.m_teacher,
                m_zhekou: values.m_zhekou

            }
        }).then(res => {
            console.log('获取所有会员卡数据233333', res)
            if (res.status === 200) {
                message.success('获取所有会员卡数据成功')
            }
        }).catch(err => {
            console.log('获取所有会员卡数据2', err)
        })
    }

    const sub = () => {
        console.log("eidt");
    }

    return (
        <div class="boxEdit">
            {/* 标题 */}
            <div class="titleEdit">
                <Button onClick={fanhui}>返回</Button>
            </div>
            {/* 表单 */}
            <div class="bodyEdit">

                <Form
                    onFinish={onFinish}
                    labelCol={{
                        span: 7,
                    }}
                    wrapperCol={{
                        span: 14,
                    }}
                    layout="horizontal"
                    style={{
                        maxWidth: 600,
                    }}
                >


                    <Form.Item label="教练" name="m_teacher">
                        <Select>
                            <Select.Option


                                options={[
                                    {
                                        value: '从有',
                                        label: '从有',
                                    },
                                    {
                                        value: '小明',
                                        label: '小明',
                                    },
                                    {
                                        value: '小张',
                                        label: '小张',
                                    },
                                ]}
                            ></Select.Option>
                        </Select>
                    </Form.Item>
                    <Form.Item label="会员积分" name="m_jifen">
                        <Input placeholder={location.state.m_jifen} />
                    </Form.Item>
                    <Form.Item label="会员折扣" name="m_zhekou">
                        <Input placeholder={location.state.m_zhekou} />
                    </Form.Item>

                    <Form.Item label="保存">
                        <Button htmlType="submit" onClick={sub}>保存</Button>
                    </Form.Item>
                </Form>
            </div>

        </div>

    )
}

export default EditMemberGrade